package mypractice;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class Leetcode2900 {
    public static void main(String[] args) {
        String[] words=new String[]{"c"};
        int[] groups=new int[]{0};
        List<String> ans =getWordsInLongestSubsequence(words,groups);
        System.out.println(ans);

    }

    public static List<String> getWordsInLongestSubsequence(String[] words, int[] groups) {
        List<String> ans = new ArrayList<>();
        int n=words.length;
        for (int i = 0; i < n; i++) {
            if (i == n - 1 || groups[i] != groups[i + 1]) {
                ans.add(words[i]);
            }
        }
//        System.out.println(ans);
        return ans;
    }
}
